
from com.ad.sword.dao.models import SystemConfig
from mongoengine.errors import DoesNotExist





def list():
    system_config = SystemConfig.objects.all()
    res = {}
    for sc in system_config:
        res[sc.name] = sc.value

    return res

def getByName(name):
    sc = None
    try:
        sc = SystemConfig.objects.get(name=name)
    except DoesNotExist:
        pass

    if sc:
        return sc.value
    else:
        return None





